<?php

class Request {

    const M_GET = 'GET';
	const M_POST = 'POST';
	const M_REQUEST = 'REQUEST';

	static private function getData($method) {
		switch ($method) {
			case self::M_GET: return $_GET; break;
			case self::M_POST: return $_POST; break;
			case self::M_REQUEST: default: return $_REQUEST; break;
		}
	}

	static function getRequestMethod() {
		return $_SERVER['REQUEST_METHOD'];
	}

	static function isPostRequest() {
		return (self::getRequestMethod() == self::M_POST) ? true : false;
	}

	static function getVar($name, $method = null) {
		$source = self::getData($method);
		if (!isset($source[$name])) {
			return null;
        }
		return $source[$name];
    }
}
